perm filename PUBXGP.PUB[D,LES] blob
sn#183956 filedate 1975-10-30 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 .DEVICE TTY
C00014 ENDMK
C⊗;
.DEVICE TTY
.command character "←";
←font 1 "basl30" font 2 "fix25" font 3 "basb30" turn on "ε" for "%" select 1
←
←page frame 55 high 81 wide
←area text lines 4 to 53 chars 1 to 81
←title area heading lines 1 to 3 chars 1 to 81
←PLACE TEXT
←IF XCRIBL THEN start <<MARGINS 1000>>;; end; TEXT!INDENT←8;
←indent text!indent,text!indent;
←
←macro pub ⊂begin if lines < 4 then next page;
←skip 1 group nofill indent 0; turn on "{" select 2⊃
←macro endpub ⊂skip 1 end⊃
←
←if xcribl then start at "↓_" ⊂"ε3"⊃ at "_↓" ⊂"ε*"⊃ end else turn on "↓_";
←
←macro sec(name) ⊂begin if lines < 4 then next page; skip spread+1 nofill indent 0;
↓_name_↓
←end⊃
←
←units←"[MILL|MILLS|INCH|INCHES|LINE|LINES]"
←
←begin group skip 5 nofill center turn on "{"
Using PUB to Produce XGP Output
{date}
←skip 3 end
←
←every heading(Using PUB to Produce XGP Output,,Page {page}) page←page+1;
There have been several additions and extensions to PUB to facilitate XGP
output. Various fonts with variable width characters can be used; and, the high
resolution of the XGP allows fine control over margins.
←sec New XGP commands
There are two ways to specify XGP output. The manuscript may contain a DEVICE
statement which specifies XGP in exactly the same way that LPT and TTY are
specified. The second method is to use the "X" compilation switch in the command
line entered from your console. Once you are in XGP mode, the PUB variable
XCRIBL will be set to -1 and THISDEVICE will be set to "XGP".
Fonts are specified with a FONT declaration of the form.
←pub
.FONT <c> <s>
←endpub continue
where <c> is a character and <s> is a string. The exact form of <c> and <s> are
site dependent. At MIT, <c> can be a digit or alphabetic, and <s> is a file
name which contains the font. File name defaults are established such that the
"system" font will be used, i.e. the default directory is FONTS, the default
device is DSK, and the default second file name is KST. Font switching is
accomplished two ways.
←pub
.SELECT <c>
←endpub continue
selects the specified font. An alternative method consists of the using "%" as
a PUB control character. As with other PUB control characters, "%" must be
turned on to have any affect. "%*" causes PUB to switch back to the previously
selected font. "%*" is not a stack mechanism. At the beginning of each PUB
block, the selected font is saved and restored at the end of the block.
←sec New or Extended Commands
←pub
.PREFACE <e> {units}
←endpub continue
evaluates the expression <e> and caues each paragraph to begin with specified
amount of blank area. The predeclared variable MILLPREFACE is set to the size of the
preface if in XGP mode; otherwise, it is in lines.
←pub
.SKIP <e> {units}
←endpub continue
leaves the appropriate amount of blank space.
←pub
.SPACING <e> {units}
←endpub continue
sets the distance between the bottom of one text and the beginning of the next.
The predeclared variable MILLSPACING is set up much the way MILLPREFACE is.
←pub
.XLENGTH <s>
←endpub
←turn on "∪"
returns the bit length of <s> in the selected font. Be careful, font switching
does ∪not take place inside <s>!
←turn on
←pub
.SNEAK <s>
←endpub
takes the string <s> and sneaks it into the XGP output. <s> is not considered for
justification purposes. For example the command
←turn on "#"
ε2SNEAK#'177;ε*
←turn on
would cause a rubout to appear in the document.
←sec New Varibles
←pub
VBPI ε1andε* HBPI
←endpub continue
initially have the vertical and horizontal resolution of the
specified device. For LPT and TTY they are 1. For other devices they are in
units of bits per inch. These variables can be changed from their initial
values if you so desire.
←pub
CHARW
←endpub continue turn on "#"
is 1 for LPT and TTY and read-only. For other devices CHARW is the bit
width of a space. It is initially set to 16, but can be set by the user. CHARW
is used by PUB to calculate the bit width of a line; thus the statement
ε2PAGE#FRAME#PAGE!HEIGHT#HIGH#PAGE!WIDTH#WIDE would causeε* would cause PUB to
generate lines of CHARW*PAGE!WIDTH bits. CHARW is indendent of the selected font.
←turn on
←pub
CHARH
←endpub continue
is read-only at all times and is 1 for LPT and TTY. For other devices CHARH
is bit height of the selected font.
←pub
MILLPREFACE ε1andε* MILLSPACING
←endpub continue
are both 1 for LPT and TTY. For other devices it is the inter-paragraph spacing
and inter-line spacing set by the PREFACE and SPACING statements respectively.
←pub
EVENLEFTBORDER, ODDLEFTBORDER, TOPBORDER, ε1andε* BOTTOMBORDER
←endpub
all are in mills. They have no effect for LPT and TTY. For other devices,
they set the borders around the area on the page where text is printed.
←pub
!XGPCOMMANDS
←endpub
allows the user to give commands to the XGP system that PUB might not otherwise
permit. At MIT, this string is put on the first page of the document after the
commands that PUB routinely puts there. Since '15 and '12 are illegal in PUB strings,
all occurences of "↔" are replaced by the string '15&'12. The string
←turn on "#"
";size#5↔;skip#100" would cause all pages of the document to be 5 inches long,
←turn on
and the first 100 pages would not be printed.
←pub
XGENLINES, MINTEMPLATE, MINCHARW, . . . .?
←endpub
←sec Example
The following example defines a macro that given a page size adjusts the page frame
to fit font 1 on a page with resonable margins.
←pub turn off "ε"
.MACRO PAPER SIZE(X,Y)⊂MILL!PAPER!HEIGHT←Y; MILL!PAPER!WIDTH←X;⊃
.
.VARIABLE PAGE!HEIGHT, PAGE!WIDTH
.
.MACRO MARGINS(εLEFT,εRIGHT,εTOP,εBOTTOM)⊂ BEGIN GROUP SELECT 1
.IF MILL!PAPER!HEIGHT ≤ 0 THEN MILL!PAPER!HEIGHT←11000; <<8.5" X 11" DEFAULT>>
.IF MILL!PAPER!WIDTH ≤ 0 THEN MILL!PAPER!WIDTH ← 8500;
.
.BIT!RASTER!WIDTH←(MILL!PAPER!WIDTH*HBPI)/1000;
.BIT!RASTER!HEIGHT←(MILL!PAPER!HEIGHT*VBPI)/1000;
.
.IF LEFT ≥ 0 THEN ODDLEFTBORDER←LEFT ELSE ODDLEFTBORDER←1500;
.IF RIGHT ≥ 0 THEN RIGHTBORDER←RIGHT ELSE RIGHTBORDER←1000;
.IF TOP ≥ 0 THEN TOPBORDER←TOP ELSE TOPBORDER←1000;
.IF BOTTOM ≥ 0 THEN BOTTOMBORDER←BOTTOM ELSE BOTTOMBORDER←500;
.
.EVENLEFTBORDER←ODDLEFTBORDER; XGP!VSP←(MILLSPACING*VBPI)/1000;
.
.PAGE!WIDTH←(BIT!RASTER!WIDTH-(HBPI*(ODDLEFTBORDER+RIGHTBORDER))/1000)/CHARW
.PAGE!HEIGHT←(BIT!RASTER!HEIGHT-(VBPI*(TOPBORDER+BOTTOMBORDER))/1000)
. /(CHARH+XGP!VSP)
.
.PAGE FRAME PAGE!WIDTH WIDE PAGE!HEIGHT HIGH
.TITLE AREA HEADING LINES 1 TO 3
.AREA TEXT LINES 4 TO PAGE!HEIGHT-2
.TITLE AREA FOOTING LINE PAGE!HEIGHT
.PLACE TEXT
.END ⊃
←endpub